package com.smart.mobile.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.smart.util.DBUtil;

public class AddressDelDao {
	int Userid =-1;	//用户ID
	int id =-1;	//地址ID
	public AddressDelDao(int Userid,int id){
		this.Userid = Userid;
		this.id = id;
	}
	public boolean AddressDelete(){

		if((Userid!=-1)&&(id!=-1)){
			String sql = "DELETE FROM address WHERE userid=? AND Id=?;";
			Connection conn=DBUtil.getConnection();
			PreparedStatement pSt;
			try {
				pSt = conn.prepareCall(sql);
				pSt.setInt(1,this.Userid);
				pSt.setInt(2,this.id);
				
				if(pSt.executeUpdate()<0)
					return false;
				else
					return true;
			} catch (SQLException e) {
				// TODO 自动生成的 catch 块
				e.printStackTrace();
				return false;
			}
			
		}
		else 
			return false;
		
			
	}
}
